<?php

include_once LIBRARIES_TOOLS . DS . 'XTemplate.php';
include_once LIBRARIES_ENTITIES . DS . 'Database.php';
include_once LIBRARIES_ENTITIES . DS . 'Gallery.php';
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 * 
 * 
 */

class biconController
{

    public function controller()
    {
	$viewfile = "block/block_icon/view/b_icon.tpl";

	$xtemplate = new XTemplate($viewfile);

	$db = new Database();
	$gallery = new Gallery();
	
	try
	{
	    $result = $gallery->getTitle_G_Active($db);

	    foreach ($result as $value)
	    {
		//echo $value->title;
		if ($value->title == 'Icon Menu')
		{
		    $gallery->setGTITLE($value->title);
		    $resultGG = $gallery->getListGalleryByName($db);
		    foreach ($resultGG as $items)
		    {
			$xtemplate->assign("LINK", $items->link);
			$xtemplate->assign("SRC", $items->image_file);
			$xtemplate->assign("HEIGHT", $items->height);
			$xtemplate->assign("WIDTH", $items->width);
                        $xtemplate->assign("DESCRIPTION", $items->description);
			$xtemplate->parse("Block_main.Block_image");
		    }
		}
	    }
	    $xtemplate->parse("Block_main");
	    $xtemplate->out("Block_main");
	}
	catch (Exception $exc)
	{
	    echo $exc->getTraceAsString();
	}
    }

}

?>
